﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JoyTalq.Core.Bus;
using JoyTalq.Core.Bus.Service;
using JoyTalq.Core.Business;
using JoyTalq.Core.Business.Service;
using JoyTalq.Core.Business.Domain;
using JoyTalq.Core.Bus.Domain;

public partial class Test : System.Web.UI.Page
{
    private BusFactory m_BusFactory;
    private BusinessFactory m_BusinessFactory;
    private IBusService m_BusService;
    private IBusinessService m_BusinessService;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            m_BusFactory = new BusFactory();
            m_BusinessFactory = new BusinessFactory();
            m_BusService = m_BusFactory.GetBusService();
            m_BusinessService = m_BusinessFactory.GetBusinessService();

            DoTest();
        }
    }

    private void DoTest()
    {
        CreateCustomer();
        ShowList();
    }

    private void CreateCustomer()
    {
        for (int i = 0; i < 10; i++)
        {
            CustomerVO customerVO = new CustomerVO();
            customerVO.NameZh = "a" + i;
            customerVO.NameEn = "b" + i;
            customerVO.CreateTime = DateTime.Now;
            customerVO.UpdateTime = DateTime.Now;
            m_BusinessService.CreateCustomer(customerVO);
        }
    }

    private void ShowList()
    {
        IList<CustomerVO> customerList = m_BusinessService.GetAllCustomerList(0, 10, "CustomerId", true);
        lblMsg.Text = string.Format("customerList={0}, ", customerList.Count.ToString());

        IList<CustomerVO> customerListAll = m_BusinessService.GetAllCustomerList();
        lblMsg.Text += string.Format("customerListAll={0}, ", customerListAll.Count.ToString());

        IList<StopVO> stopList = m_BusService.GetAllStopList(0, 10, "Id", true);
        lblMsg.Text += string.Format("stopList={0}, ", stopList.Count.ToString());
    }
}